package io.gitee.thinkbungee.config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author chenyichang
 * @date 2022/3/8
 */
public class MongoCondition implements Condition {

    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        String database = conditionContext.getEnvironment().getProperty("generator.database");
        return "mongodb".equalsIgnoreCase(database);
    }
}
